<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="t" uri="http://www.sishuok.com/tags/easyui-tags" %>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <title>丰源轮胎销售管理系统| 登录</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
    <link rel="shortcut icon" href="<%=request.getContextPath()%>/resources/images/logo.ico">

    <t:base type="cloudAdmin,fontAwesome,jquery,jqueryUI,uniform,bootstrap,animate,layer"></t:base>

    <!-- JAVASCRIPTS -->
    <t:base type="jQuery-Cookie,hubspot-messenger,script"></t:base>
    <t:base type="jqueryValidate"></t:base>

    <!-- BACKSTRETCH -->
    <script type="text/javascript"
            src="<%=request.getContextPath()%>/resources/plug-in/backstretch/jquery.backstretch.min.js"></script>
    <!-- CUSTOM SCRIPT -->
</head>

<body class="login">

<!-- PAGE -->
<section id="page">
    <!-- HEADER -->
    <header>
        <!-- NAV-BAR -->
        <div class="container">
            <div class="row">
                <div class="col-md-4 col-md-offset-4">
                    <div id="logo">
                        <a href="index.html"><img src="http://www.fytire.com/public/img/logo.jpg"
                                                  height="40" alt="logo name"/></a>
                    </div>
                </div>
            </div>
        </div>
        <!--/NAV-BAR -->
    </header>
    <!--/HEADER -->
    <!-- LOGIN -->
    <section id="login_bg" class="visible">
        <div class="container">
            <div class="row">
                <div class="col-md-4 col-md-offset-4">
                    <div class="login-box">
                        <h2 class="bigintro " style="color: black; font-weight: 400;">丰源轮胎销售管理系统</h2>
                        <div class="divide-40"></div>
                        <form role="form" id="loginForm" method="post">
                            <div class="form-group">
                                <label>账号</label>
                                <i class="fa fa-envelope"></i>
                                <input type="text" class="form-control" id="username" name="username" autofocus
                                       value="${param.username}" placeholder="用户名/工号/手机号/邮箱">
                            </div>
                            <div class="form-group">
                                <label>密码</label>
                                <i class="fa fa-lock"></i>
                                <input type="password" class="form-control" id="userPwd" name="password">
                            </div>
                            <div>
                                <label class="checkbox"> <input type="checkbox" class="uniform" value="">记住密码</label>

                                <button class="btn btn-danger" id="submitForm" onclick="loginClick()">确认</button>
                                <%--<input id="submitForm" type="submit" class="btn btn-danger" value="登录">--%>
                            </div>
                        </form>
                        <!-- SOCIAL LOGIN -->
                        <div class="divide-20"></div>
                        <!-- /SOCIAL LOGIN -->
                        <div class="login-helpers">
                            <a href="#" onclick="swapScreen('forgot_bg');return false;">忘记密码?</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <!--/LOGIN -->

    <!-- FORGOT PASSWORD -->
    <section id="forgot_bg">
        <div class="container">
            <div class="row">
                <div class="col-md-4 col-md-offset-4">
                    <div class="login-box">
                        <h2 class="bigintro" style="color: white;">重置密码</h2>
                        <div class="divide-40"></div>
                        <form role="form" id="passwordForm">
                            <div class="form-group">
                                <label for="email">输入你的邮箱</label>
                                <i class="fa fa-envelope"></i>
                                <input type="email" class="form-control" id="email" name="email">
                            </div>
                            <div>
                                <button type="submit" class="btn btn-info" id="emailBtn">发送重置密码</button>
                                <%--<input type="submit" class="submit" value="提交" />--%>
                            </div>
                        </form>
                        <div class="login-helpers">
                            <a href="#" onclick="swapScreen('login_bg');return false;">返回登陆</a> <br>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <!-- FORGOT PASSWORD -->
</section>
<!--/PAGE -->


<script>
    jQuery(document).ready(function () {
        App.setPage("login_bg");  //Set current page
        App.init(); //Initialise plugins and elements

        // 表单验证
        $("#passwordForm").validate({
            rules: {
                email: {
                    required: true
                }
            },
            submitHandler: function(form) {
                $.ajax({
                    url: "<%=request.getContextPath()%>/user/password/find",
                    type: "GET",
                    data: $("#passwordForm").serialize(),
                    dataType: "json",
                    cache: false,
                    beforeSend: function() {
                        $("#emailBtn").prop("disabled", true);
                    },
                    success: function(message) {

                        if (message.errorCode == "0") {
                            alert("发送成功");

                        } else {
                            alert(message.errorMessage);
//                            $submit.prop("disabled", false);
                        }
                    }
                });
            }
        });

    });

</script>
<script type="text/javascript">
    //$(document).keydown(function(event){
    //if(event.keyCode == 13){ //绑定回车
    //$('#login_btn').click();
    //}
    //});
    function swapScreen(id) {
        jQuery('.visible').removeClass('visible animated fadeInUp');
        jQuery('#' + id).addClass('visible animated fadeInUp');
    }
    function loginClick(){
        layer.load();
    }
</script>
</body>
</html>